﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using SoufunData.DB;

namespace SoufunData
{
    public partial class ExToDbBBPlanningDesign : DevExpress.XtraEditors.XtraForm
    {
        public ExToDbBBPlanningDesign()
        {
            InitializeComponent();
        }

        private void btn_excelPath_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {

            openFileDialog1.Filter = "Excel文件|*.xls;*.xlsx";
            openFileDialog1.FileName = "";
            openFileDialog1.ShowDialog();
            string fileName = openFileDialog1.FileName;
            btn_excelPath.Text = fileName;

            gridControl2.DataSource = null;
            gridView2.Columns.Clear();
            gridView2.GroupPanelText = "请选择Excel文件";
            if (fileName == "")
            {
                return;
            }
            DataSet ds = Common.LoadDataFromExcel(fileName);
            if (ds == null || ds.Tables.Count == 0)
            {
                string strError = "读取Excel时发生错误，请核对：\r\n ";
                strError += "1，导入时请在Excel中关闭想要导入的文件！\r\n";
                strError += "2，导入的Excel表中的工作表名称必须为Sheet1,否者程序无法读取！\r\n";
                strError += "3，请确保您的计算机安装了Microsoft Office！\r\n";
                strError += "4，请确保导入的Excel文件正常！";
                XtraMessageBox.Show(strError);
                btn_excelPath.Text = "";
                return;
            }            
            if (!CheckExcelColumnsName(ds.Tables[0]))
            {
                btn_excelPath.Text = "";
                return;
            }
            DataTable dt = ds.Tables[0].Copy();
            dt.Clear();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row[0].ToString() == "" && row[1].ToString() == ""
                    && row[2].ToString() == "")
                {
                    continue;
                }
                dt.Rows.Add(row.ItemArray);
            }
            gridControl2.DataSource = dt;
            gridView2.GroupPanelText = "共有" + dt.Rows.Count + "条数据";
        }


        private void AddData()
        {
           
            DataTable dtOld = (DataTable)gridControl2.DataSource;

            DataTable dt = dtOld.Copy();
            dt.Rows.Clear();
            foreach (DataRow dataRow in dtOld.Rows)
            { 
                dt.Rows.Add(dataRow.ItemArray);
            }

            SqlClass sqlClass = new SqlClass();
            List<string> existProject = new List<string>();
            foreach (DataRow row in dt.Rows)
            {
                string proName = row["项目名称"].ToString();
                if (sqlClass.ExistProjectName(proName, "tbplanningdesign"))
                {
                    existProject.Add(proName);
                }
            }
            if (existProject.Count > 0)
            {
                StringBuilder strWarming = new StringBuilder();
                strWarming.Append("您选择的Excel表格中的以下项目在数据库中已存在,不能再次添加：\r\n");
                foreach (string sproName in existProject)
                {
                    strWarming.Append(sproName);
                    strWarming.Append("\r\n");
                }
                XtraMessageBox.Show(strWarming.ToString());
                BeginInvoke(new MethodInvoker(() =>
                {
                    btn_excelPath.Text = "";
                    gridControl2.DataSource = null;
                    btn_excelPath.Enabled = true;
                    btn_add.Enabled = true;
                }));
                return;
            }


            int insertRowsCount = 500;//一次性插入数据库行数
            int succeedrows = 0;//成功插入数据行数
            StringBuilder strSql = new StringBuilder();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i==12)
                {
                    Console.WriteLine("222");
                }
                DataRow row = dt.Rows[i]; 
                string strProName = row["项目名称"].ToString();
                string strCoverArea = row["占地面积（平米）"].ToString();
                if (strCoverArea.Trim() == "" || strCoverArea.Trim() == "-")
                {
                    strCoverArea = "0";
                }
                string strBuildingArea = row["总建筑面积（平米）"].ToString();
                if (strBuildingArea.Trim() == "" || strBuildingArea.Trim() == "-")
                {
                    strBuildingArea = "0";
                }
                string strBusinessArea = row["商业建筑面积（平米）"].ToString();
                if (strBusinessArea.Trim() == "" || strBusinessArea.Trim() == "-")
                {
                    strBusinessArea = "0";
                }
                string strDecorate = row["装修状况"].ToString();
                string strRongJiLv = row["容积率"].ToString();
                if (strRongJiLv.Trim() == "" || strRongJiLv.Trim() == "-")
                {
                    strRongJiLv = "0";
                }
                string strLvHuaLv = row["绿化率"].ToString();              
                string strBuildingType = row["建筑类型"].ToString();
                string strIsPlanOutStreet = row["是否规划外街"].ToString();
                string strBusinessOutSteeetTheme = row["商业外街业态主题"].ToString();
                string strBusinessOutSteeetRate = row["商业外街体量占比"].ToString();
                string strBusinessInSteeetTheme = row["商业内街业态主题"].ToString();
                string strBusinessInSteeetRate = row["商业内街体量占比"].ToString();
                string strUnderBuildingFloorCount = row["地下建筑层数"].ToString();
                string strOverBuildingFloorCount = row["地上建筑层数"].ToString();
                string strAreaOfOneFloor = row["单层面积（平米）"].ToString();
                if (strAreaOfOneFloor.Trim() == "" 
                    || strAreaOfOneFloor.Trim() == "-")
                {
                    strAreaOfOneFloor = "0";
                }
                string strHeightOfTheFirstFoor = row["首层层高（米）"].ToString();
                if (strHeightOfTheFirstFoor.Trim() == ""
               || strHeightOfTheFirstFoor.Trim() == "-")
                {
                    strHeightOfTheFirstFoor = "0";
                }
                string strShouCengJingGao = row["首层净高"].ToString();
                if (strShouCengJingGao.Trim() == ""
                     || strShouCengJingGao.Trim() == "-")
                {
                    strShouCengJingGao = "0";
                }
                string strQiTaCengCengGao = row["其他层层高（米）"].ToString();
                if (strQiTaCengCengGao.Trim() == ""
                  || strQiTaCengCengGao.Trim() == "-")
                {
                    strQiTaCengCengGao = "0";
                }
                string strQiTaCengJingGao = row["其他层净高（米）"].ToString();
                if (strQiTaCengJingGao.Trim() == ""
                   || strQiTaCengJingGao.Trim() == "-")
                {
                    strQiTaCengJingGao = "0";
                }
                string strPillarDistance = row["柱距大小"].ToString();
                string strEntranceCount = row["正入口数量"].ToString();
                string strEntranceWidth = row["正入口宽度"].ToString();
                string strSideEntranceCount = row["侧入口数量"].ToString();
                string strSideEntranceWidth = row["侧入口宽度"].ToString();
                string strInStreetWidth = row["内街宽度"].ToString();
                string strOutStreetWidth = row["外街宽度"].ToString();
                string strMainWalkWidth = row["主走道宽度"].ToString();
                string strMinorWalkWidth = row["次走道宽度"].ToString();
                string strMainShopArea = row["主力商铺面积区间"].ToString();
                string strMainShopWidth = row["主力商铺面宽（米）"].ToString();
                string strMainShopHeight = row["主力商铺进深（米）"].ToString();
                string strStaircaseLocation = row["扶梯位置"].ToString();
                string strStaircaseCount = row["单层扶梯数量"].ToString();
                string strStaircaseBrand = row["扶梯品牌"].ToString();
                string strPsgLiftLocation = row["客梯位置"].ToString();
                string strPsgLiftCount = row["客梯数量"].ToString();
                string strPsgLiftBrand = row["客梯品牌"].ToString();
                string strPsgLiftZKL = row["客梯载客量"].ToString();
                string strViewLiftLocation = row["观光梯位置"].ToString();
                string strViewLiftCount = row["观光梯数量"].ToString();
                string strViewLiftBrand = row["观光梯品牌"].ToString();
                string strViewLiftZKL = row["观光梯载客量"].ToString();
                string strGoodLadderCount = row["货梯数量"].ToString();
                string strGoodLadderBrand = row["货梯品牌"].ToString();
                string strGoodLadderZZL = row["货梯载重量"].ToString();
                string strIsCenterConditioner = row["是否中央空调"].ToString();
                string strConditionerBrand = row["空调品牌"].ToString();
                string strWCLocation = row["卫生间位置"].ToString();
                string strWCConfig = row["卫生间功能配置"].ToString();
                string strWCCount = row["单层卫生间数量"].ToString();
                string strWCArea = row["单层卫生间面积"].ToString();
                string strClearBrand = row["洁具品牌"].ToString();
                string strStoolBrand = row["马桶品牌"].ToString();
                string strOutFacadeType = row["外立面类型"].ToString();
                string strOutFacadeColor = row["外立面色调"].ToString();
                string strOutSquareConfig = row["室外广场设置"].ToString();
                string strOutSquareArea = row["室外广场面积"].ToString();
                string strCenterSquareConfig = row["中庭广场设置"].ToString();
                string strCenterSquareArea = row["中庭广场面积"].ToString();
                string strGreenConfig = row["绿化平台设置"].ToString();
                string strGreenArea = row["绿化平台面积"].ToString();
                string strIndoorDesignTheme = row["室内设计主题"].ToString();
                string strIndoorDesignStyle = row["室内设计风格"].ToString();
                string strDesignColor = row["设计色彩"].ToString();
                string strWallSpace = row["墙面"].ToString();
                string strFloor = row["地面"].ToString();
                string strLightingDecorate = row["灯光装饰"].ToString();
                string strGuideSystem = row["导识系统"].ToString(); 

                if (i % insertRowsCount == 0)
                {
                    strSql = new StringBuilder();
                    strSql.Append("Insert into tbplanningdesign (");
                    strSql.Append("ProjectName,");
                    strSql.Append("CoverArea,");
                    strSql.Append("BuildingArea,");
                    strSql.Append("BusinessArea,");
                    strSql.Append("Decorate,");
                    strSql.Append("RongJiLv,");
                    strSql.Append("LvHuaLv,");
                    strSql.Append("BuildingType,");
                    strSql.Append("IsPlanOutStreet,");
                    strSql.Append("BusinessOutSteeetTheme,");
                    strSql.Append("BusinessOutSteeetRate,");
                    strSql.Append("BusinessInSteeetTheme,");
                    strSql.Append("BusinessInSteeetRate,");
                    strSql.Append("UnderBuildingFloorCount,");
                    strSql.Append("OverBuildingFloorCount,");
                    strSql.Append("AreaOfOneFloor,");
                    strSql.Append("HeightOfTheFirstFoor,");
                    strSql.Append("ShouCengJingGao,");
                    strSql.Append("QiTaCengCengGao,");
                    strSql.Append("QiTaCengJingGao,");
                    strSql.Append("PillarDistance,");
                    strSql.Append("EntranceCount,");
                    strSql.Append("EntranceWidth,");
                    strSql.Append("SideEntranceCount,");
                    strSql.Append("SideEntranceWidth,");
                    strSql.Append("InStreetWidth,");
                    strSql.Append("OutStreetWidth,");
                    strSql.Append("MainWalkWidth,");
                    strSql.Append("MinorWalkWidth,");
                    strSql.Append("MainShopArea,");
                    strSql.Append("MainShopWidth,");
                    strSql.Append("MainShopHeight,");
                    strSql.Append("StaircaseLocation,");
                    strSql.Append("StaircaseCount,");
                    strSql.Append("StaircaseBrand,");
                    strSql.Append("PsgLiftLocation,");
                    strSql.Append("PsgLiftCount,");
                    strSql.Append("PsgLiftBrand,");
                    strSql.Append("PsgLiftZKL,");
                    strSql.Append("ViewLiftLocation,");
                    strSql.Append("ViewLiftCount,");
                    strSql.Append("ViewLiftBrand,");
                    strSql.Append("ViewLiftZKL,");
                    strSql.Append("GoodLadderCount,");
                    strSql.Append("GoodLadderBrand,");
                    strSql.Append("GoodLadderZZL,");
                    strSql.Append("IsCenterConditioner,");
                    strSql.Append("ConditionerBrand,");
                    strSql.Append("WCLocation,");
                    strSql.Append("WCConfig,");
                    strSql.Append("WCCount,");
                    strSql.Append("WCArea,");
                    strSql.Append("ClearBrand,");
                    strSql.Append("StoolBrand,");
                    strSql.Append("OutFacadeType,");
                    strSql.Append("OutFacadeColor,");
                    strSql.Append("OutSquareConfig,");
                    strSql.Append("OutSquareArea,");
                    strSql.Append("CenterSquareConfig,");
                    strSql.Append("CenterSquareArea,");
                    strSql.Append("GreenConfig,");
                    strSql.Append("GreenArea,");
                    strSql.Append("IndoorDesignTheme,");
                    strSql.Append("IndoorDesignStyle,");
                    strSql.Append("DesignColor,");
                    strSql.Append("WallSpace,");
                    strSql.Append("Floor,");
                    strSql.Append("LightingDecorate,");
                    strSql.Append("GuideSystem)");

                    strSql.Append(" value  ");
                }
                strSql.Append("(");
                strSql.Append("'");
                strSql.Append(strProName);
                strSql.Append("',");
                strSql.Append(strCoverArea);
                strSql.Append(",");
                strSql.Append(strBuildingArea);
                strSql.Append(",");
                strSql.Append(strBusinessArea);
                strSql.Append(",'");
                strSql.Append(strDecorate);
                strSql.Append("',");
                strSql.Append(strRongJiLv);
                strSql.Append(",'");
                strSql.Append(strLvHuaLv);
                strSql.Append("','");
                strSql.Append(strBuildingType);
                strSql.Append("','");
                strSql.Append(strIsPlanOutStreet);
                strSql.Append("','");
                strSql.Append(strBusinessOutSteeetTheme);
                strSql.Append("','");
                strSql.Append(strBusinessOutSteeetRate);
                strSql.Append("','");
                strSql.Append(strBusinessInSteeetTheme);
                strSql.Append("','");
                strSql.Append(strBusinessInSteeetRate);
                strSql.Append("','");
                strSql.Append(strUnderBuildingFloorCount);              
                strSql.Append("','");
                strSql.Append(strOverBuildingFloorCount);
                strSql.Append("',");
                strSql.Append(strAreaOfOneFloor);
                strSql.Append(",");
                strSql.Append(strHeightOfTheFirstFoor);
                strSql.Append(",");
                strSql.Append(strShouCengJingGao);
                strSql.Append(",");
                strSql.Append(strQiTaCengCengGao);
                strSql.Append(",");
                strSql.Append(strQiTaCengJingGao);
                strSql.Append(",'");
                strSql.Append(strPillarDistance);
                strSql.Append("','");
                strSql.Append(strEntranceCount);
                strSql.Append("','");
                strSql.Append(strEntranceWidth);
                strSql.Append("','");
                strSql.Append(strSideEntranceCount);
                strSql.Append("','");
                strSql.Append(strSideEntranceWidth);
                strSql.Append("','");
                strSql.Append(strInStreetWidth);
                strSql.Append("','");
                strSql.Append(strOutStreetWidth);
                strSql.Append("','");
                strSql.Append(strMainWalkWidth);
                strSql.Append("','");
                strSql.Append(strMinorWalkWidth);
                strSql.Append("','");
                strSql.Append(strMainShopArea);
                strSql.Append("','");
                strSql.Append(strMainShopWidth);
                strSql.Append("','");
                strSql.Append(strMainShopHeight);
                strSql.Append("','");
                strSql.Append(strStaircaseLocation);
                strSql.Append("','");
                strSql.Append(strStaircaseCount);
                strSql.Append("','");
                strSql.Append(strStaircaseBrand);
                strSql.Append("','");
                strSql.Append(strPsgLiftLocation);
                strSql.Append("','");
                strSql.Append(strPsgLiftCount);              
                strSql.Append("','");
                strSql.Append(strPsgLiftBrand);
                strSql.Append("','");
                strSql.Append(strPsgLiftZKL);
                strSql.Append("','");
                strSql.Append(strViewLiftLocation);
                strSql.Append("','");
                strSql.Append(strViewLiftCount);
                strSql.Append("','");
                strSql.Append(strViewLiftBrand);
                strSql.Append("','");
                strSql.Append(strViewLiftZKL);
                strSql.Append("','");
                strSql.Append(strGoodLadderCount);
                strSql.Append("','");
                strSql.Append(strGoodLadderBrand);
                strSql.Append("','");
                strSql.Append(strGoodLadderZZL);
                strSql.Append("','");
                strSql.Append(strIsCenterConditioner);
                strSql.Append("','");
                strSql.Append(strConditionerBrand);
                strSql.Append("','");
                strSql.Append(strWCLocation);
                strSql.Append("','");
                strSql.Append(strWCConfig);
                strSql.Append("','"); 
                strSql.Append(strWCCount);
                strSql.Append("','");
                strSql.Append(strWCArea);
                strSql.Append("','");
                strSql.Append(strClearBrand);
                strSql.Append("','");
                strSql.Append(strStoolBrand);
                strSql.Append("','");
                strSql.Append(strOutFacadeType);
                strSql.Append("','");
                strSql.Append(strOutFacadeColor);
                strSql.Append("','");
                strSql.Append(strOutSquareConfig);
                strSql.Append("','");
                strSql.Append(strOutSquareArea);
                strSql.Append("','");
                strSql.Append(strCenterSquareConfig);
                strSql.Append("','");
                strSql.Append(strCenterSquareArea);
                strSql.Append("','");
                strSql.Append(strGreenConfig);
                strSql.Append("','");
                strSql.Append(strGreenArea);
                strSql.Append("','");
                strSql.Append(strIndoorDesignTheme);
                strSql.Append("','");
                strSql.Append(strIndoorDesignStyle);
                strSql.Append("','");
                strSql.Append(strDesignColor);
                strSql.Append("','");
                strSql.Append(strWallSpace);
                strSql.Append("','");
                strSql.Append(strFloor);
                strSql.Append("','");
                strSql.Append(strLightingDecorate);
                strSql.Append("','");
                strSql.Append(strGuideSystem);                 
                strSql.Append("'),");

                if ((i + 1) % insertRowsCount == 0
                    || i == dt.Rows.Count - 1)
                {
                    strSql.Remove(strSql.Length - 1, 1);
                    try
                    {
                        succeedrows += DbHelper.ExecuteSql(strSql.ToString());
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show(ex.Message);
                    }

                }
            }

            if (dt.Rows.Count == succeedrows)
            {
                XtraMessageBox.Show("添加成功！");
                BeginInvoke(new MethodInvoker(() =>
                {
                    btn_excelPath.Text = "";
                    gridControl2.DataSource = null;
                    gridView2.GroupPanelText = "请选择想要导入的Excel表！";
                }));
            }
            else
            {
                int failedCount = dt.Rows.Count - succeedrows;
                XtraMessageBox.Show("共记" + dt.Rows.Count + "条数据，其中"
                    + failedCount + "条数据添加失败！");
            }
            BeginInvoke(new MethodInvoker(() =>
            {
               
                btn_excelPath.Enabled = true;
                btn_add.Enabled = true;
            }));
        }

        private void btn_add_Click(object sender, EventArgs e)
        {
            if (btn_excelPath.Text.Trim()=="")
            {
                XtraMessageBox.Show("请先选择Excel！");
                return;
            }
            if (!CheckDataValid())
            {
                return;
            }
             
            btn_excelPath.Enabled = false;
            btn_add.Enabled = false;
            Thread t = new Thread(AddData) { IsBackground = true };
            t.Start();
        }

        #region 数据完整性检测
        private bool CheckDataValid()
        {
            DataTable dt = (DataTable)gridControl2.DataSource;
            StringBuilder strErrors = new StringBuilder();
           
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                string strProName = dr["项目名称"].ToString();
                string strCoverArea = dr["占地面积（平米）"].ToString();
                string strBuildingArea = dr["总建筑面积（平米）"].ToString();
                string strBusinessArea = dr["商业建筑面积（平米）"].ToString();
                string strRongJiLv = dr["容积率"].ToString();
                string strAreaOfOneFloor = dr["单层面积（平米）"].ToString();
                string strHeightOfTheFirstFoor = dr["首层层高（米）"].ToString();
                string strShouCengJingGao = dr["首层净高"].ToString();
                string strQiTaCengCengGao = dr["其他层层高（米）"].ToString();
                string strQiTaCengJingGao = dr["其他层净高（米）"].ToString();
                
                if (strProName.Trim() == "")
                {
                    strErrors.Append("第"+(i+2)+"行数据中的【项目名称】为空！\r\n"); 
                }
                float floatTemp;
                if (strCoverArea.Trim()!="" &&
                    strCoverArea!="-"&&
                    !float.TryParse(strCoverArea, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【占地面积（平米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if ( strBuildingArea.Trim()!="" &&
                     strBuildingArea != "-" &&
                    !float.TryParse(strBuildingArea, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【总建筑面积（平米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strBusinessArea.Trim()!="" &&
                    strBusinessArea != "-" &&
                    !float.TryParse(strBusinessArea, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【商业建筑面积（平米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if ( strRongJiLv.Trim()!="" &&
                     strRongJiLv != "-" &&
                    !float.TryParse(strRongJiLv, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【容积率】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strAreaOfOneFloor.Trim()!="" &&
                    strAreaOfOneFloor.Trim() != "-" &&
                    !float.TryParse(strAreaOfOneFloor, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【单层面积（平米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strHeightOfTheFirstFoor!="" &&
                    strHeightOfTheFirstFoor != "-" &&
                    !float.TryParse(strHeightOfTheFirstFoor, out floatTemp))
                {
                    strErrors.Append("第" + (i +2)
                   + "行数据中【首层层高（米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strShouCengJingGao != "" &&
                    strShouCengJingGao != "-" &&
                    !float.TryParse(strShouCengJingGao, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【首层净高】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strQiTaCengCengGao != "" &&
                    strQiTaCengCengGao != "-" &&
                    !float.TryParse(strQiTaCengCengGao, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【其他层层高（米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
                if (strQiTaCengJingGao != "" &&
                    strQiTaCengJingGao != "-" &&
                    !float.TryParse(strQiTaCengJingGao, out floatTemp))
                {
                    strErrors.Append("第" + (i + 2)
                   + "行数据中【其他层净高（米）】的数据格式有误，不是正确的数字格式！\r\n");
                }
               
            }
            if (strErrors.ToString() != "")
            {                
                XtraMessageBox.Show("您选择的Excel中的数据存在以下错误：\r\n"+
                    strErrors);
                return false;
            }              
            return true;
        }
         
        private bool CheckExcelColumnsName(DataTable dt)
        {
            StringBuilder strErrors = new StringBuilder();
            if (!dt.Columns.Contains("项目名称"))
            {
                strErrors.Append("【项目名称】、");
            }
            if (!dt.Columns.Contains("占地面积（平米）"))
            {
                strErrors.Append("【占地面积（平米）】、");
            }
            if (!dt.Columns.Contains("总建筑面积（平米）"))
            {
                strErrors.Append("【总建筑面积（平米）】、");
            }
            if (!dt.Columns.Contains("商业建筑面积（平米）"))
            {
                strErrors.Append("【商业建筑面积（平米）】、");
            }
            if (!dt.Columns.Contains("装修状况"))
            {
                strErrors.Append("【装修状况】、");
            }
            if (!dt.Columns.Contains("容积率"))
            {
                strErrors.Append("【容积率】、");
            }
            if (!dt.Columns.Contains("绿化率"))
            {
                strErrors.Append("【绿化率】、");
            }
            if (!dt.Columns.Contains("建筑类型"))
            {
                strErrors.Append("【建筑类型】、");
            }
            if (!dt.Columns.Contains("是否规划外街"))
            {
                strErrors.Append("【是否规划外街】、");
            }
            if (!dt.Columns.Contains("商业外街业态主题"))
            {
                strErrors.Append("【商业外街业态主题】、");
            }
            if (!dt.Columns.Contains("商业外街体量占比"))
            {
                strErrors.Append("【商业外街体量占比】");
            }
            if (!dt.Columns.Contains("商业内街业态主题"))
            {
                strErrors.Append("【商业内街业态主题】");
            }
            if (!dt.Columns.Contains("商业内街体量占比"))
            {
                strErrors.Append("【商业内街体量占比】");
            }
            if (!dt.Columns.Contains("地下建筑层数"))
            {
                strErrors.Append("【地下建筑层数】");
            }
            if (!dt.Columns.Contains("地上建筑层数"))
            {
                strErrors.Append("【地上建筑层数】");
            }
            if (!dt.Columns.Contains("单层面积（平米）"))
            {
                strErrors.Append("【单层面积（平米）】");
            }
            if (!dt.Columns.Contains("首层层高（米）"))
            {
                strErrors.Append("【首层层高（米）】");
            }
            if (!dt.Columns.Contains("首层净高"))
            {
                strErrors.Append("【首层净高】");
            }
            if (!dt.Columns.Contains("其他层层高（米）"))
            {
                strErrors.Append("【其他层层高（米）】");
            }
            if (!dt.Columns.Contains("其他层净高（米）"))
            {
                strErrors.Append("【其他层净高（米）】");
            }
            if (!dt.Columns.Contains("柱距大小"))
            {
                strErrors.Append("【柱距大小】");
            }
            if (!dt.Columns.Contains("正入口数量"))
            {
                strErrors.Append("【正入口数量】");
            }
            if (!dt.Columns.Contains("正入口宽度"))
            {
                strErrors.Append("【正入口宽度】");
            }
            if (!dt.Columns.Contains("侧入口数量"))
            {
                strErrors.Append("【侧入口数量】");
            }
            if (!dt.Columns.Contains("侧入口宽度"))
            {
                strErrors.Append("【侧入口宽度】");
            }
            if (!dt.Columns.Contains("内街宽度"))
            {
                strErrors.Append("【内街宽度】");
            }
            if (!dt.Columns.Contains("外街宽度"))
            {
                strErrors.Append("【外街宽度】");
            }
            if (!dt.Columns.Contains("主走道宽度"))
            {
                strErrors.Append("【主走道宽度】");
            }
            if (!dt.Columns.Contains("次走道宽度"))
            {
                strErrors.Append("【次走道宽度】");
            }
            if (!dt.Columns.Contains("主力商铺面积区间"))
            {
                strErrors.Append("【主力商铺面积区间】");
            }
            if (!dt.Columns.Contains("主力商铺面宽（米）"))
            {
                strErrors.Append("【主力商铺面宽（米）】");
            }
            if (!dt.Columns.Contains("主力商铺进深（米）"))
            {
                strErrors.Append("【主力商铺进深（米）】");
            }
            if (!dt.Columns.Contains("扶梯位置"))
            {
                strErrors.Append("【扶梯位置】");
            }
            if (!dt.Columns.Contains("单层扶梯数量"))
            {
                strErrors.Append("【单层扶梯数量】");
            }
            if (!dt.Columns.Contains("扶梯品牌"))
            {
                strErrors.Append("【扶梯品牌】");
            }
            if (!dt.Columns.Contains("客梯位置"))
            {
                strErrors.Append("【客梯位置】");
            }
            if (!dt.Columns.Contains("客梯数量"))
            {
                strErrors.Append("【客梯数量】");
            }
            if (!dt.Columns.Contains("客梯品牌"))
            {
                strErrors.Append("【客梯品牌】");
            }
            if (!dt.Columns.Contains("客梯载客量"))
            {
                strErrors.Append("【客梯载客量】");
            }
            if (!dt.Columns.Contains("观光梯位置"))
            {
                strErrors.Append("【观光梯位置】");
            }
            if (!dt.Columns.Contains("观光梯数量"))
            {
                strErrors.Append("【观光梯数量】");
            }
            if (!dt.Columns.Contains("观光梯品牌"))
            {
                strErrors.Append("【观光梯品牌】");
            }
            if (!dt.Columns.Contains("观光梯载客量"))
            {
                strErrors.Append("【观光梯载客量】");
            }
            if (!dt.Columns.Contains("货梯数量"))
            {
                strErrors.Append("【货梯数量】");
            }
            if (!dt.Columns.Contains("货梯品牌"))
            {
                strErrors.Append("【货梯品牌】");
            }
            if (!dt.Columns.Contains("货梯载重量"))
            {
                strErrors.Append("【货梯载重量】");
            }
            if (!dt.Columns.Contains("是否中央空调"))
            {
                strErrors.Append("【是否中央空调】");
            }
            if (!dt.Columns.Contains("空调品牌"))
            {
                strErrors.Append("【空调品牌】");
            }
            if (!dt.Columns.Contains("卫生间位置"))
            {
                strErrors.Append("【卫生间位置】");
            }
            if (!dt.Columns.Contains("卫生间功能配置"))
            {
                strErrors.Append("【卫生间功能配置】");
            }
            if (!dt.Columns.Contains("单层卫生间数量"))
            {
                strErrors.Append("【单层卫生间数量】");
            }
            if (!dt.Columns.Contains("单层卫生间面积"))
            {
                strErrors.Append("【单层卫生间面积】");
            }
            if (!dt.Columns.Contains("洁具品牌"))
            {
                strErrors.Append("【洁具品牌】");
            }
            if (!dt.Columns.Contains("马桶品牌"))
            {
                strErrors.Append("【马桶品牌】");
            }
            if (!dt.Columns.Contains("外立面类型"))
            {
                strErrors.Append("【外立面类型】");
            }
            if (!dt.Columns.Contains("外立面色调"))
            {
                strErrors.Append("【外立面色调】");
            }
            if (!dt.Columns.Contains("室外广场设置"))
            {
                strErrors.Append("【室外广场设置】");
            }
            if (!dt.Columns.Contains("室外广场面积"))
            {
                strErrors.Append("【室外广场面积】");
            }
            if (!dt.Columns.Contains("中庭广场设置"))
            {
                strErrors.Append("【中庭广场设置】");
            }
            if (!dt.Columns.Contains("中庭广场面积"))
            {
                strErrors.Append("【中庭广场面积】");
            }
            if (!dt.Columns.Contains("绿化平台设置"))
            {
                strErrors.Append("【绿化平台设置】");
            }
            if (!dt.Columns.Contains("绿化平台面积"))
            {
                strErrors.Append("【绿化平台面积】");
            }
            if (!dt.Columns.Contains("室内设计主题"))
            {
                strErrors.Append("【室内设计主题】");
            }
            if (!dt.Columns.Contains("室内设计风格"))
            {
                strErrors.Append("【室内设计风格】");
            }
            if (!dt.Columns.Contains("设计色彩"))
            {
                strErrors.Append("【设计色彩】");
            }
            if (!dt.Columns.Contains("墙面"))
            {
                strErrors.Append("【墙面】");
            }
            if (!dt.Columns.Contains("地面"))
            {
                strErrors.Append("【地面】");
            }
            if (!dt.Columns.Contains("灯光装饰"))
            {
                strErrors.Append("【灯光装饰】");
            }
            if (!dt.Columns.Contains("导识系统"))
            {
                strErrors.Append("【导识系统】");
            }
           

            if (strErrors.ToString() != "")
            {
                XtraMessageBox.Show("您选择的Excel表数据不正常,缺少以下数据列:\r\n" +
                                    strErrors);
                return false;
            }
            return true;
        }
        #endregion
    }
}